// ignore_for_file: must_be_immutable
import 'package:aitao_flutter/style/box_style.dart';
import 'package:flutter/material.dart';
import 'package:get/get.dart';

import '../../const/common_const.dart';
import '../../res/r.dart';
import '../../style/color_style.dart';
import '../../style/edgeInsets_style.dart';
import '../../style/radius_style.dart';
import '../../style/text_style.dart';
import '../controller/video_response_controller.dart';

class VideoResponsePage extends StatefulWidget {
  VideoResponsePage(
      {super.key, required this.answerCallBack, required this.hangupCallBack});
  VoidCallback answerCallBack;
  VoidCallback hangupCallBack;
  @override
  State<VideoResponsePage> createState() => _VideoResponsePageState();
}

class _VideoResponsePageState extends State<VideoResponsePage> {
  VideoResponseController requestController =
      Get.put(VideoResponseController());
  List l = [1, 2, 3, 4, 5, 6, 7, 8, 9];
  @override
  Widget build(BuildContext context) {
    return GetBuilder<VideoResponseController>(builder: (controller) {
      return Scaffold(
          backgroundColor: const Color(0xFF5E5858),
          body: CustomScrollView(
            slivers: [
              headerContainer(),
              gravitationContainer(),
              bottomContainer()
            ],
          ));
    });
  }

  Widget headerContainer() {
    return SliverToBoxAdapter(
      child: Container(
        padding: const EdgeInsets.fromLTRB(0, 40, 0, 0),
        child: Column(
          crossAxisAlignment: CrossAxisAlignment.center,
          children: [
            Row(
              mainAxisAlignment: MainAxisAlignment.end,
              children: [
                Image.asset(
                  ImagePath.assetsIconLevel,
                  width: 28,
                  height: 25,
                ),
                Box.hBox7,
                const Text(
                  'LV.3相见恨晚',
                  style: TextStyle(fontSize: 16, color: ColorStyle.whiteColor),
                ),
                Box.hBox15
              ],
            ),
            Box.vBox10,
            Image.asset(
              ImagePath.assetsImagesHeaderForWomen,
              width: 75,
              height: 75,
            ),
            Box.hBox7,
            const Text('默契值200',
                style: TextStyle(fontSize: 12, color: Color(0xFFFF5D6F))),
            const Text('心tao5554',
                style: TextStyle(fontSize: 16, color: ColorStyle.whiteColor)),
            Box.vBox12,
            Row(mainAxisAlignment: MainAxisAlignment.end, children: [
              Container(
                alignment: Alignment.centerRight,
                padding: EdgeInsetsStyle.edgeInsets(15, 7),
                decoration: BoxDecoration(
                    borderRadius: RadiusStyle.setPortionRadius(
                        PortionRaduisType.raduisTopLeftAndBottomLeft, 21),
                    gradient: ColorStyle.charmValueColor),
                child: const Text(
                  '魅力值: 88%',
                  style: TextStyle(fontSize: 15, color: ColorStyle.whiteColor),
                ),
              )
            ])
          ],
        ),
      ),
    );
  }

  /// 引力标签
  Widget gravitationContainer() {
    return SliverToBoxAdapter(
      child: Container(
        padding: EdgeInsetsStyle.customMargin(18, 12, 18, 70),
        child: Column(
          crossAxisAlignment: CrossAxisAlignment.start,
          children: [
            const Text('引力标签:',
                style: TextStyle(fontSize: 16, color: ColorStyle.whiteColor)),
            // Container(
            //   padding: EdgeInsetsStyle.customMargin(26, 12, 26, 20),
            //   color: ColorStyle.orangeColor,
            // ),
            Container(
              // color: ColorStyle.whiteColor,
              padding: EdgeInsetsStyle.customMargin(0, 15, 16, 0),
              child: Wrap(
                  alignment: WrapAlignment.start,
                  spacing: 23,
                  runSpacing: 15,
                  children: l.map((e) {
                    return _gravitationItemWidget('声音甜美*8');
                  }).toList()),
            )
          ],
        ),
      ),
    );
  }

  Widget _gravitationItemWidget(String title) {
    return Container(
      decoration: BoxDecoration(
          borderRadius: RadiusStyle.radiusAll(13.5),
          color: ColorStyle.themeColor),
      padding: EdgeInsetsStyle.edgeInsets(9.5, 4),
      child: Text(
        title,
        style: Styles.whiteText_13,
      ),
    );
  }

  /// 挂断
  Widget bottomContainer() {
    return SliverToBoxAdapter(
      child: Column(children: [
        const Text(
          '视频单价300贝壳/分钟',
          style: TextStyle(fontSize: 13, color: ColorStyle.whiteColor),
        ),
        Box.vBox20,
        Row(
          mainAxisAlignment: MainAxisAlignment.center,
          children: [
            Column(
              children: [
                GestureDetector(
                  child: Image.asset(
                    ImagePath.assetsChatAnswer,
                    width: 70,
                    height: 70,
                  ),
                  onTap: () {
                    widget.answerCallBack();
                  },
                ),
                Box.vBox10,
                const Text(ChatStringConst.videoCallAnswer,
                    style:
                        TextStyle(fontSize: 18, color: ColorStyle.whiteColor))
              ],
            ),
            Box.hBox(80),
            Column(
              children: [
                GestureDetector(
                  child: Image.asset(
                    ImagePath.assetsChatHangup,
                    width: 70,
                    height: 70,
                  ),
                  onTap: () {
                    widget.hangupCallBack();
                  },
                ),
                Box.vBox10,
                const Text(ChatStringConst.videoCallHangup,
                    style:
                        TextStyle(fontSize: 18, color: ColorStyle.whiteColor))
              ],
            )
          ],
        )
      ]),
    );
  }
}
